/* $RCSFile: ADNDynKbarticletemplate.cs $
 * Apache license v2 2011 by Christian Surieux
 * $Source: ?/CRMWrapper3/DynEntities/ADNDynKbarticletemplate.cs $
 * $log$
 * Revision 19 2010/10/02 14:01:49  christian.surieux
 *   Corrected a bug in allmost everyADNDyn file for PrimaryFieldVualue
 * Revision 6 2010/08/06 19:56:33  christian.surieux
 *   Added Log to All cs files
 */

/* Copyrights Christian Surieux 2010 */
/* Class ADNDynKbarticletemplate */
/* Date 2010-01-06 16:02:19Z */

using System;
using System.Diagnostics;
using System.Collections;
using System.ComponentModel;
using System.Collections.Generic;
using System.Text;
using CrmSdk;

namespace AddonNice.CRMWrapper
{
    public class ADNDynKbarticletemplate : DynEntity
    {
        protected class Ftor: DFactor
        {
            public Ftor() : base(CrmStr.kbarticletemplate)
            {}

            public override Type DynType
            { get { return typeof(ADNDynKbarticletemplate); } }

            public override string DynTypename
            {   get{ return CrmStr.kbarticletemplate;}}

            public override DynEntity Build()
            {   return new ADNDynKbarticletemplate();}

            public override DynEntity Build(CRMWrapperBase w, InternalDynamicEntity dEntity, PropertyDescriptorCollection wproperties)
            {   return new ADNDynKbarticletemplate(w, dEntity, wproperties, null);}

            public override DynEntity Build(CRMWrapperBase w, string PrimaryFieldValue)
            {   return new ADNDynKbarticletemplate(w,PrimaryFieldValue);}

            public override DynEntity Build(CRMWrapperBase w,Guid PrimaryKeyValue)
            {   return new ADNDynKbarticletemplate(w,PrimaryKeyValue);}
        }

        static ADNDynKbarticletemplate(){new Ftor();} 
        
        public override bool HasOwnerProperty
        {
            get { return false; }
        }
        
        public ADNDynKbarticletemplate() : base() { }
        
        public ADNDynKbarticletemplate(CRMWrapperBase w,string PrimaryFieldValue)
            : base(w,CrmStr.kbarticletemplate)
        {
            if ( PrimaryFieldValue != string.Empty )
                title = PrimaryFieldValue;
        }
        
        public ADNDynKbarticletemplate(CRMWrapperBase w,Guid CrmId) : base(w,CrmStr.kbarticletemplate,CrmId) { }
        
        public ADNDynKbarticletemplate(CRMWrapperBase w,InternalDynamicEntity e) : base(w,CrmStr.kbarticletemplate,e,null,null) { }
        
        public ADNDynKbarticletemplate(CRMWrapperBase w,InternalDynamicEntity e,PropertyDescriptorCollection prop,InternalColumnSet s) : base(w,CrmStr.kbarticletemplate,e,prop,s) { }
        
        public ADNDynKbarticletemplate(ResetWrapperHandler fn,string PrimaryFieldValue)
            : base(fn,CrmStr.kbarticletemplate)
        {
            if ( PrimaryFieldValue != string.Empty )
                title = PrimaryFieldValue;
        }
        
        public ADNDynKbarticletemplate(ResetWrapperHandler fn,Guid CrmId) : base(fn,CrmStr.kbarticletemplate,CrmId) { }
        
        public ADNDynKbarticletemplate(ResetWrapperHandler fn,InternalDynamicEntity e) : base(fn,CrmStr.kbarticletemplate,e,null,null) { }
        
        public ADNDynKbarticletemplate(ResetWrapperHandler fn,InternalDynamicEntity e,PropertyDescriptorCollection prop,InternalColumnSet s) : base(fn,CrmStr.kbarticletemplate,e,prop,s) { }

        /* Properties */

        [CrmDynAttribute(CrmStr.kbarticletemplate)]
        public Guid kbarticletemplateid
        {
            get
            { return KeyPropertyValue(CrmStr.kbarticletemplateid); }
            set
            { AddKeyProperty(CrmStr.kbarticletemplateid,value); }
        }

        protected override void SetCrmIdProperty(Guid crmId)
        {
            if ( !dicProperty.ContainsKey(CrmStr.kbarticletemplateid) || KeyPropertyValue(CrmStr.kbarticletemplateid) != crmId )
                kbarticletemplateid = crmId;
        }
        public override Guid PrimaryKeyGuidValue
        {
            get
            { return kbarticletemplateid; }
            set { kbarticletemplateid = value; }
        }
        
        public override string PrimaryFieldName
        {
            get
            { return CrmStr.title; }
            set
            {}
        }

        /// <summary>
        /// Value contained in the PrimaryField for the DynEntity or empty if no PrimaryField
        /// </summary>
        public override string PrimaryFieldStringValue
        {
            get
            {
                return title;
            }
            set
            {
                title =   value;
            }
        }

        [CrmDynAttribute(CrmStr.kbarticletemplate)]
        public string description
        {
            get
            { return StringPropertyValue(CrmStr.description); }
            set
            { AddStringProperty(CrmStr.description,value); }
        }

        [CrmDynAttribute(CrmStr.kbarticletemplate)]
        public string formatxml
        {
            get
            { return StringPropertyValue(CrmStr.formatxml); }
            set
            { AddStringProperty(CrmStr.formatxml,value); }
        }

        [CrmDynAttribute(CrmStr.kbarticletemplate)]
        public bool isactive
        {
            get
            { return BooleanPropertyValue(CrmStr.isactive); }
            set
            { AddBooleanProperty(CrmStr.isactive,value); }
        }

        [CrmDynAttribute(CrmStr.kbarticletemplate)]
        public int languagecode
        {
            get
            { return NumberPropertyValue(CrmStr.languagecode); }
            set
            { AddNumberProperty(CrmStr.languagecode,value); }
        }

        [CrmDynAttribute(CrmStr.kbarticletemplate)]
        public override Guid organizationid
        {
            get
            { return LookupPropertyValue(CrmStr.organizationid); }
        }

        [CrmDynAttribute(CrmStr.kbarticletemplate)]
        public string structurexml
        {
            get
            { return StringPropertyValue(CrmStr.structurexml); }
            set
            { AddStringProperty(CrmStr.structurexml,value); }
        }

        [CrmDynAttribute(CrmStr.kbarticletemplate)]
        public string title
        {
            get
            { return StringPropertyValue(CrmStr.title); }
            set
            { AddStringProperty(CrmStr.title,value); }
        }
    }
}